// 获取应用实例
const app = getApp();

// pages/mine/mine.js
Page({
  /**
   * 页面的初始数据
   */
  data: {
    hide: app.globalData.hide,
    scrollTop: 0,
    navBarHeight: app.globalData.navBarHeight,
    menuRight: app.globalData.menuRight,
    menuBotton: app.globalData.menuBotton,
    menuTop: app.globalData.menuTop,
    menuHeight: app.globalData.menuHeight,
    statusList: [
      {
        id: 1,
        title: "待付款",
        active: 1,
        icon: "/static/icon/order/daifukuan.png",
      },
      {
        id: 2,
        title: "待发货",
        active: 2,
        icon: "/static/icon/order/daifahuo.png",
      },
      {
        id: 3,
        title: "待收货",
        active: 3,
        icon: "/static/icon/order/daishouhuo.png",
      },
      {
        id: 4,
        title: "评价",
        active: 4,
        icon: "/static/icon/order/pingjia.png",
      },
      {
        id: 5,
        title: "售后",
        active: 5,
        icon: "/static/icon/order/shouhou.png",
      },
    ],
    serveList: [
      {
        id: 1,
        title: "我的收藏",
        icon: "/static/icon/serve/shoucang.png",
        url: "/pages/collection/collection",
      },
      {
        id: 2,
        title: "关注店铺",
        icon: "/static/icon/serve/dianpu.png",
        url: "/pages/attShop/attShop",
      },
      {
        id: 3,
        title: "会员中心",
        icon: "/static/icon/serve/huiyuan.png",
        url: "/pages/member/member",
      },
      {
        id: 4,
        title: "收货地址",
        icon: "/static/icon/serve/dizhi.png",
        url: "/pages/address/address",
      },
      {
        id: 5,
        title: "客服",
        icon: "/static/icon/serve/kefu.png",
        url: "/pages/kefu/kefu",
      },
    ],
  },
  // 事件处理函数

  onPageScroll(e) {
    this.setData({
      scrollTop: e.scrollTop,
    });
  },

  //扫一扫方法
  getScancode: function () {
    var _this = this;
    // 允许从相机和相册扫码
    wx.scanCode({
      success: (res) => {
        var SampleBarcode = res.result;
        _this.setData({
          SampleBarcode: SampleBarcode,
        });
        wx.showToast({
          title: "开发中",
          // title: "扫码成功",
          icon: "none",
          duration: 1000,
        });
      },
      fail: (err) => {
        //接口调用失败的回调函数
        wx.showToast({
          title: "扫码失败",
          icon: "error",
          duration: 1000,
        });
      },
    });
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) { },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() { },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {
    if (typeof this.getTabBar === "function" && this.getTabBar()) {
      this.getTabBar().setData({
        selected: 4,
      });
    }
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() { },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() { },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() { },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() { },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() { },
  // 分享到朋友圈
  onShareTimeline() { },
});
